/*
 * Copyright (c) 2001, 2002 Boris Pruessmann and others. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Common Public License v0.5 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/cpl-v05.html
 *
 * Contributors: Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.api;

import net.sourceforge.perforce.api.internal.Error;

/**
 * @version $Revision: 491 $
 * @author <a href="mailto:bpruessmann@users.sourceforge.net>Boris
 *         Pruessmann</a>
 */
public interface IClientApi {

  /**
   * Disposes the ClientApi.
   *
   * @return result code.
   */
  int dispose();

  /**
   * Sets a Perforce protocol option.
   *
   * @param key name of the protocol option.
   * @param value value of the protocol option.
   */
  void setProtocol(String key, String value);

  /**
   * Gets a Perforce protocol option.
   *
   * @param key name of the protocol option.
   * @return the value of the protocol option.
   */
  String getProtocol(String key);

  /**
   * Initializes the ClientApi.
   *
   * @param charSet the character set to use.
   */
  void init(CharSetEnum charSet);

  /**
   * Runs the specified IPerforceCommand.
   *
   * @param arguments the arguments of the operation.
   * @param command the command to run.
   */
  void run(String[] arguments, IPerforceCommand command);

  /**
   * Checks whether the connection to the Perforce server was dropped.
   *
   * @return true if connection to Perforce server has dropped.
   */
  boolean dropped();

  /**
   * Sets the value of P4CHARSET.
   *
   * @param charset the new charset.
   */
  void setCharset(String charset);

  /**
   * Retrieves the value of P4CHARSET.
   *
   * @return the value of P4CHARSET.
   */
  String getCharset();

  /**
   * Sets the value of P4CLIENT.
   *
   * @param client new value of P4CLIENT.
   */
  void setClient(String client);

  /**
   * Retrieves the current value of P4CLIENT.
   *
   * @return current value of P4CLIENT
   */
  String getClient();

  /**
   * Sets the value of P4HOST.
   *
   * @param host new value of P4HOST.
   */
  void setHost(String host);

  /**
   * Retrieves the value of P4HOST.
   *
   * @return the current value of P4HOST.
   */
  String getHost();

  /**
   * Sets the value of P4LANGUAGE.
   *
   * @param language new value of P4LANGUAGE.
   */
  void setLanguage(String language);

  /**
   * Retrieves the current value of P4LANGUAGE.
   *
   * @return value of P4LANGUAGE.
   */
  String getLanguage();

  /**
   * Sets the value of P4PASSWORD.
   *
   * @param password new value of P4PASSWORD.
   */
  void setPassword(String password);

  /**
   * Retrieves the current value of P4PASSWORD.
   *
   * @return value of P4PASSWORD.
   */
  String getPassword();

  /**
   * Sets the value of P4PORT.
   *
   * @param port new value for P4PORT.
   */
  void setPort(String port);

  /**
   * Retrieves the value of P4PORT.
   *
   * @return current value of P4PORT.
   */
  String getPort();

  /**
   * Sets the value of P4USER.
   *
   * @param user new value of P4USER.
   */
  void setUser(String user);

  /**
   * Retrieves the current value of P4USER.
   *
   * @return current value of P4USER.
   */
  String getUser();

  /**
   * Returns a Error for init and dispose.
   *
   * @return the Error instance.
   */
  Error getPerforceError();

  /**
   * Sets the working directory.
   *
   * @param cwd The working directory
   */
  void setCwd(String cwd);

  /**
   * Gets the working directory.
   *
   * @return the working directory
   */
  String getCwd();
}
